{__NOLAYOUT__}
<include file="Public/meta"/>
        
        

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <button class="btn btn-primary" id="submit"><i class="icon-save"></i> 提交</button>
    
  <div class="btn-group">
  </div>
</div>
<div class="well">
    
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane active in" id="home">
    <form id="attr" method="post" enctype="multipart/form-data" action="__SELF__">
      <!-- <input class="btn btn-primary" type="submit" id="submit"> -->

        <label>产品名称：{$product.pro_name}</label>
        
        <br/>

        <label>产品类别：{$product.catename}</label>
        
        <br/>


        <label>限购数量</label>
        <input type="number" value="{$pro_attr.restrict_nub}" class="input-xlarge" id="restrict_nub" name='restrict_nub' >

        <label>封面图片</label>
        <input type="file" name="main_img" id="main_img">
        <br/><br/>
        
        <label>详情图片</label>
        <input type="file" name="detail_img[]" id="detail_img" multiple="">
        <br/><br/>

        <label>详情信息图片</label>
        <input type="file" id="detail_info_img[]" name='detail_info_img'>
        <br/><br/>

        <label>水印类型</label>
        <select name="water_type" id="water_type" class="input-xlarge" style="width:100px">
            <option value="0">无水印</option>
            <option value="1">图片水印</option>
            <option value="2">文字水印</option>
        </select>

        <span class="water">
          
        </span>

        <label>产品材质</label>
        <input type="text" value="{$pro_attr.materials}" class="input-xlarge" id="materials" name='materials'>

        <label>适用性别</label>
        <input type="radio" value="0" class="input-xlarge"  name='apple_gender'>男
        <span style="display: inline-block; width: 80px;"></span>
        <input type="radio" value="1" class="input-xlarge"  name='apple_gender'>女
        <span style="display: inline-block; width: 80px;"></span>
        <input type="radio" value="2" class="input-xlarge"  name='apple_gender'>中性
        <br/><br/>

        <label>产品货号</label>
        <input type="text" value="{$pro_attr.article_number}" class="input-xlarge" id="article_number" name='article_number'>

        <label>模特</label>
        <select name="model_id" id="model_id" class="input-xlarge">
          <volist name='model_list' id='value'>
            <option value="{$value.model_id}" <if condition="$value.model_id eq $pro_attr['model_id']">selected</if> >{$value.model_name}</option>
          </volist>
        </select>

        <label>面料</label>
        <input type="text" value="{$pro_attr.lining}" class="input-xlarge" id="lining" name='lining'>

     
    </form>
      </div>
      
  </div>

</div>





<script type="text/javascript">
  var water_type = $("#water_type");
  var water = $('.water');
  water_type.change(function(){
    var type = water_type.val();
    if(type==1){
      var pic = '<label>图片水印</label><input type="file" id="water" name="water"><br/><br/>';
      water.html(pic);
    }else if(type==2){
      var text = '<label>文字水印</label><input type="text" id="water" class="input-xlarge" name="water"><br/><br/>';
      water.html(text);
    }else{
      water.html('');
    }
  })

  $("#submit").click(function(){
 
    var fromdata = new FormData($('#attr')[0]);
    // alert(fromdata);return false;
    // for (var i=0;i<ufile.files.length;i++) {
    //   // 在每个匹配元素里面的末尾处插入参数内容
    //   fromdata.append("ufiles[]",ufile.files[i]);
    // }
    $.ajax({
      type:'post',
      url:'__SELF__',
      dataType:'json',
      data:fromdata,
      processData : false,  //必须false才会避开jQuery对 formdata 的默认处理   
      contentType : false,  //必须false才会自动加上正确的Content-Type 
      success:function(msg){
        if(msg.code=='1'){
          
          layer.msg(msg.info,{icon:1,time:1000},function(index){
            window.parent.location.reload();
          });

        }else{
          layer.msg(msg.info,{icon:2,time:1000});
          return false;
        }
      }
    });

  })
   
  
</script>